package com.yuexun.dhdoctor.module.Contract.adapter;

import android.view.View;
import android.widget.AbsListView;
import android.widget.ImageView;

import com.yuexun.dhdoctor.R;
import com.yuexun.dhdoctor.module.login.bean.AreaHospBean;

import org.kymjs.kjframe.widget.AdapterHolder;
import org.kymjs.kjframe.widget.KJAdapter;

import java.util.Collection;

/**
 * Created by chenss on 2017/12/5 0005.
 */

public class HospitalSelectAdapter extends KJAdapter<AreaHospBean> {

    private int selectHospitalId;

    public void setSelectHospital(int selectHospitalId) {
        this.selectHospitalId = selectHospitalId;
        notifyDataSetInvalidated();
    }

    public HospitalSelectAdapter(AbsListView view, Collection<AreaHospBean> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
    }

    @Override
    public void convert(AdapterHolder helper, AreaHospBean item, boolean isScrolling) {
        ImageView select_bt = helper.getView(R.id.select_bt);
        helper.setText(R.id.hospitalName,item.getHospitalName());
        if(item.getId() == selectHospitalId){
            select_bt.setVisibility(View.VISIBLE);
        }else{
            select_bt.setVisibility(View.GONE);
        }
    }
}
